package cn.net.xyan.easy.spring.jpa.support;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;

import javax.persistence.Tuple;
import java.util.List;

/**
 * Created by zarra on 16/1/22.
 */
public interface IModelQuery<T> {
    List<T> findAllForModel( Object queryModel);
    Page<T> findAllForModel(Object queryModel, Pageable pageable);
    <R> List<R> findAllForModel( Object queryModel, Class<R> responseType);
    <R> Page<R> findAllForModel(Object queryModel, Class<R> responseType, Pageable pageable);

    <R> List<R> findAllForModel(Specification<T> specification, Class<R> responseType);
    <R> Page<R> findAllForModel(Specification<T> specification, Class<R> responseType, Pageable pageable);

    Page<Tuple> findAllForTuple(Specification<T> specification,Pageable pageable);
    List<Tuple> findAllForTuple(Specification<T> specification);
}
